<?php

class Application_Form_Granja extends Zend_Form
{

    public function init()
    {
        //TODO review, the row is created with 0 like id
        $this->setMethod('post');
        $id = new Zend_Form_Element_Hidden('id');
        $id->setDecorators(array('ViewHelper'));

        $this->addElement($id);

        $this->addElement('text', 'nombre', array(
            'label' => 'Nombre:',
            'required' => true,
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(5, 20))
            )
        ));

        $this->addElement('checkbox', 'activo', array(
                'label' => 'Activo:')
        );

        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore' => true,
            'label' => 'Crear granja',
        ));
        // And finally add some CSRF protection
//        $this->addElement('hash', 'csrf', array(
//            'ignore' => true,
//        ));
    }
}

